#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Linq;
using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;

#endregion

namespace VisualWebGuiApplication2
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            using (GazOnDevEntities db =new GazOnDevEntities())
            {

                user dd = db.users.FirstOrDefault(x => x.username == textBox1.Text && x.password == maskedTextBox1.Text);
                           
                if (dd.id > 0)
                {
                    Session["isloged"] = "true";
                    if (Convert.ToBoolean(dd.isadmin)) Session["isadmin"] = "true";
                    Session["username"] = dd.username;
                    this.Context.Redirect("MainForm.wgx");
                }
                
            }
        }
    }
}